package com.ccrfid.rmc6.entity.mattress;

import com.ccrfid.rmc6.entity.JsonBaseEntity;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "ht_mattress_state")
public class MattressStateEntity extends JsonBaseEntity {
    private Long id;
    private String mattressSn;
    private Integer protocolVersion;
    private Integer firmwareVersion;
    private Integer state;
    private Integer heartRate;
    private Integer breathRate;
    private Integer weight;
    private Integer wet;
    private List<Integer> position = new ArrayList<>();
    private Integer sleepState;
    private Timestamp recordTime;

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "mattress_sn", nullable = false)
    public String getMattressSn() {
        return mattressSn;
    }

    public void setMattressSn(String mattressSn) {
        this.mattressSn = mattressSn;
    }

    @Basic
    @Column(name = "protocol_version")
    public Integer getProtocolVersion() {
        return protocolVersion;
    }

    public void setProtocolVersion(Integer protocolVersion) {
        this.protocolVersion = protocolVersion;
    }

    @Basic
    @Column(name = "firmware_version")
    public Integer getFirmwareVersion() {
        return firmwareVersion;
    }

    public void setFirmwareVersion(Integer firmwareVersion) {
        this.firmwareVersion = firmwareVersion;
    }

    @Basic
    @Column(name = "state")
    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    @Basic
    @Column(name = "heart_rate")
    public Integer getHeartRate() {
        return heartRate;
    }

    public void setHeartRate(Integer heartRate) {
        this.heartRate = heartRate;
    }

    @Basic
    @Column(name = "breath_rate")
    public Integer getBreathRate() {
        return breathRate;
    }

    public void setBreathRate(Integer breathRate) {
        this.breathRate = breathRate;
    }

    @Basic
    @Column(name = "weight")
    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    @Basic
    @Column(name = "wet")
    public Integer getWet() {
        return wet;
    }

    public void setWet(Integer wet) {
        this.wet = wet;
    }

    @Type(type = "json")
    @Column(name = "position", columnDefinition = "json")
    public List<Integer> getPosition() {
        return position;
    }

    public void setPosition(List<Integer> position) {
        this.position = position;
    }

    @Basic
    @Column(name = "sleep_state")
    public Integer getSleepState() {
        return sleepState;
    }

    public void setSleepState(Integer sleepState) {
        this.sleepState = sleepState;
    }

    @Basic
    @Column(name = "record_time", nullable = false)
    @UpdateTimestamp
    public Timestamp getRecordTime() {
        return recordTime;
    }

    public void setRecordTime(Timestamp recordTime) {
        this.recordTime = recordTime;
    }
}
